package com.xoa.controller.rms.rollRoom;

import com.xoa.model.rms.RmsRollRoom;
import com.xoa.service.rms.RmsRollRoomService;
import com.xoa.util.ToJson;
import com.xoa.util.common.http.Request;
import com.xoa.util.page.PageParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Administrator on 2017/12/22.
 */
@Controller
@RequestMapping("/rmsRollRoom")
public class RmsRollRoomController {

    @Autowired
    private RmsRollRoomService rmsRollRoomService;

    /**
     * 作者: 张航宁
     * 日期: 2017/12/22
     * 说明: 主页面映射
     */
    @RequestMapping("/manage")
    public String toManage(){
        return "/app/rms/rollRoom/manage";
    }

    /**
     * 作者: 张航宁
     * 日期: 2017/12/22
     * 说明: 添加接口
     */
    @ResponseBody
    @RequestMapping("/save")
    public ToJson<RmsRollRoom> save(RmsRollRoom rmsRollRoom, HttpServletRequest request){
        return rmsRollRoomService.save(rmsRollRoom,request);
    }

    /**
     * 作者: 张航宁
     * 日期: 2017/12/22
     * 说明: 根据id查询
     */
    @ResponseBody
    @RequestMapping("/selectById")
    public ToJson<RmsRollRoom> selectById(Integer roomId){
        return rmsRollRoomService.selectById(roomId);
    }

    /**
     * 作者: 张航宁
     * 日期: 2017/12/22
     * 说明: 更新接口
     */
    @ResponseBody
    @RequestMapping("/update")
    public ToJson<RmsRollRoom> update(RmsRollRoom rmsRollRoom, HttpServletRequest request){
        return rmsRollRoomService.update(rmsRollRoom,request);
    }

    /**
     * 作者: 张航宁
     * 日期: 2017/12/22
     * 说明: 删除接口
     */
    @ResponseBody
    @RequestMapping("/delete")
    public ToJson<RmsRollRoom> delete(RmsRollRoom rmsRollRoom, HttpServletRequest request){
        return rmsRollRoomService.delete(rmsRollRoom,request);
    }

    /**
     * 作者: 张航宁
     * 日期: 2017/12/22
     * 说明: 查询接口
     */
    @ResponseBody
    @RequestMapping("/query")
    public ToJson<RmsRollRoom> query(RmsRollRoom rmsRollRoom, PageParams pageParams){
        return rmsRollRoomService.query(rmsRollRoom,pageParams);
    }

    /**
     * 作者: 张航宁
     * 日期: 2017/12/26
     * 说明:获取所有的卷库名称和id
     */
    @ResponseBody
    @RequestMapping("/selectAll")
    public ToJson<RmsRollRoom> selectAll(){
        return rmsRollRoomService.selectAll();
    }


}
